<title>Property Ads Posted By You</title>
<div id="view-content">
    <h2>Property Ads Posted By You</h2>
    <div class="row-fluid">        
        <div class="span12">
            <?php
            if(!sizeof($this->details)){
                echo "<h3 class='alert'>No apartments posted</h3>";
            }else{                                       
            ?>                        
            <table class="table">
                <tbody>
                    <?php
                    foreach ($this->details as $detail) :
                        $db = new Ads_Model_Rentdetails();
                        $zipDb = new Ads_Model_Zipcode();
                        $rentDetailsArray = $db->getDetailsJson($detail->details);
                        $photoArray = $db->getPhotoArrayFromJson($rentDetailsArray);
                        ?>                
                        <tr style="height: 200px;">
                            <td class="well" >
                                <div class="span3"><img src="/uploads/<?= $photoArray[0]; ?>" width="250" height="250" /></div>
                                <div class="span6" style="margin-left: 10px;">
                                    <div>
                                        <h4>Title: <?php echo $rentDetailsArray->adTitle; ?></h4>
                                    </div>
                                    <div><b>Description:</b> 
                                        <?php echo $rentDetailsArray->adDesc; ?>
                                    </div>
                                    <div>
                                        <b>House No.:</b> <?= $rentDetailsArray->houseno; ?><br>
                                        <b>Street Name:</b> <?= $rentDetailsArray->streetName ?><br>
                                        <b>Zip code: </b> <?php
                                        $zipData = $zipDb->getByPrimaryKey($rentDetailsArray->zipcode);
                                        echo $zipData[0]['codes'];
                                        $cityId = $zipData[0]['city_id'];
                                        ?><br>
                                        <b>City: </b><?php
                                        $cityDb = new Ads_Model_City();
                                        $cityData = $cityDb->getCityById($cityId);
                                        echo $cityData[0]['name'];
                                        $stateId = $cityData[0]['state_id'];
                                        ?><br>
                                        <b>State: </b><?php
                                        $stateDb = new Ads_Model_State();
                                        $stateData = $stateDb->getStateById($stateId);
                                        echo $stateData[0]['name'];
                                        ?>
                                    </div>                                    
                                </div>
                                <div class="span2">
                                    <a class="btn btn-success" href="<?= $this->url(array('id' => $detail->id), 'edit-ads'); ?>" title=" Edit this property"><i class="icon-white icon-edit"></i></a>
                                    <?php if ($detail->banned) { ?>
                                    <a class="btn btn-success" href="<?= $this->url(array('id' => $detail->id), 'blockuserads'); ?>" title="Allow this property for Search Listing" ><i class="icon-white icon-ok-sign"></i></a>
                                    <?php } else { ?>
                                        <a class="btn btn-danger" href="<?= $this->url(array('id' => $detail->id), 'blockuserads'); ?>" title="Block this property from Search Listing" ><i class="icon-white icon-ban-circle"></i></a>
                                    <?php }
                                    ?>
                                    <a class="btn btn-danger" href="<?= $this->url(array('id' => $detail->id), 'delete-ads'); ?>" title="Delete this property forever"><i class="icon-white icon-trash"></i> </a>                                    
                                </div>
                            </td>                            
                        </tr>                              
                        <tr>
                            <td>&nbsp;</td>
                        </tr>
                        <?php
                    endforeach;
                    ?>
                </tbody>
            </table>   
            <?php
            }
            ?>
            
        </div>
    </div>    
</div>